 

package com.zdkj.subway.rca.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;

import com.zdkj.subway.rca.entity.SwCkDataSubmit;
import com.zdkj.subway.rca.service.SwCkDataSubmitService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 报表调账-对账提交
 *
 * @author stw
 * @date 2020-10-30 22:13:02
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swckdatasubmit" )
@Api(value = "swckdatasubmit", tags = "报表调账-对账提交管理（废弃）")
public class SwCkDataSubmitController {

    private final SwCkDataSubmitService swCkDataSubmitService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swCkDataSubmit 报表调账-对账提交
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwCkDataSubmitPage(Page page, SwCkDataSubmit swCkDataSubmit) {
        return R.ok(swCkDataSubmitService.page(page, Wrappers.query(swCkDataSubmit)));
    }


    /**
     * 修改报表调账-对账提交状态
     * @param swCkDataSubmits
     * @return R
     */
    @ApiOperation(value = "修改报表调账-对账提交状态,swCkDataSubmit 填充id和status(值是'1')", notes = "修改报表调账-对账提交状态,swCkDataSubmit 填充id和status(值是'1')")
    @SysLog("修改报表调账-对账提交状态" )
    @PostMapping("/submit" )
    @PreAuthorize("@pms.hasPermission('sw_ck_data_submit_submit')" )
    public R submit(@RequestBody List<SwCkDataSubmit> swCkDataSubmits) {
        return R.ok(swCkDataSubmitService.updateBatchById(swCkDataSubmits));
    }

}
